package my.senix.sc.config;

import org.springframework.boot.web.servlet.context.ServletWebServerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * Created by lhs on 2018/11/25.
 */
@Component
public class ServerPortFetcher implements ApplicationListener<ServletWebServerInitializedEvent> {

    @Override
    public void onApplicationEvent(ServletWebServerInitializedEvent event) {
        int port = event.getWebServer().getPort();

        System.out.println("******************服务器端口为：" + port);
    }
}
